/**
 * There are code generation
 */
package com.neusoft.lohas.modules.ivm.dao.merchant;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.neusoft.lohas.common.persistence.BaseDao;
import com.neusoft.lohas.common.persistence.Parameter;
import com.neusoft.lohas.modules.ivm.entity.merchant.DeliveryMember;

/**
 * 送货员DAO接口
 * @author Jackie.Liu
 * @version 2014-11-03
 */
@Repository
public class DeliveryMemberDao extends BaseDao<DeliveryMember> {

	public int getSumIndentByMemberId(String id) {
		String sql = "select count(id) from ivm_indent where deliveryman_id = :p1 and del_flag = :p2";
		List<Object> list = findBySql(sql, new Parameter(id, DeliveryMember.DEL_FLAG_NORMAL));
		if(list == null){
			return 0;
		}
		return Integer.valueOf(list.get(0).toString());
	}

	public Object findByName(int type, String name, String mId) {
		return getByHql("from DeliveryMember where type = :p1 and name = :p2 and merchant.id = :p3 and delFlag = :p4", new Parameter(type, name, mId, DeliveryMember.DEL_FLAG_NORMAL));
	}
}
